package cn.k7g.alloy.ioc.provide;

import cn.k7g.alloy.expose.DataProvider;
import cn.k7g.alloy.mold.var.AbsVar;
import cn.k7g.alloy.mold.var.ConstVar;
import cn.k7g.alloy.mold.var.LinkVar;
import org.springframework.stereotype.Component;

/**
 * 链接数据
 * @author victor-wu
 * @date 2021/9/27 下午1:10
 */
@Component
public final class LinkDataProvide implements DataProvider<String> {
    @Override
    public boolean supports(AbsVar var) {
        return var instanceof LinkVar;
    }

    @Override
    public String get(AbsVar var) {
        LinkVar lv = (LinkVar) var;
        return String.format("<a href=\"%s\" target=>%s</a>", var.getFirstParam(), lv.getText());
    }
}
